﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jzy.BLL.SiteAdmin;
using Jzy.Model.SiteAdmin;
using Jzy.Core.Common;
using Jzy.Core.Common.Web;

namespace Jzy.Web.WebSite
{
    public partial class PictureList : System.Web.UI.Page
    {

        private string MenuCode
        {
            get
            {
                return Request.QueryString["MenuCode"];
            }
        }
        PagerSortSetting _setting;
        protected void Page_Load(object sender, EventArgs e)
        {
            _setting = this.Pager1.InitPager(new BindViewHandler(BindView));
            if (!IsPostBack)
            {
                BindView();
            }
        }
        private void BindView()
        {
            MenuBO menu = new MenuBO();
            litMenuName.Text = menu.GetInfo(menu.GetIDByCode(int.Parse(MenuCode))).Name;

            ArticleBO aritcle = new ArticleBO();
            IEnumerable<ArticleInfo> list = aritcle.GetDisplayListByCode(int.Parse(MenuCode));

            _setting.PageSize = 12;

            list = _setting.GetList<ArticleInfo>(list);

            rpt.DataSource = list;
            rpt.DataBind();
        }

        protected string GetUrl(object source, object bigImageAbsPath)
        {
            if (source != null && source.ToString() != "")
            {
                return source.ToString();
            }
            else
            {
                return bigImageAbsPath.ToString();
            }
        }
    }
}
